<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of mailAction
 *
 * @author waterfrog
 */
class Action extends tfAction {
    //put your code here

    public function mailAction(){
     
        $this->assign('content',"this is mail template");
        //echo tfUrl::site("sendmail");
        $form = new tfForm("Title","frm_test", tfUrl::site("sendmail"), "frm_test");

        $name = new tfFormInput("text", "name", "name", "姓名", '', array('size'=>10,'maxlength'=>20));
        $form->addElement($name);

        $email = new tfFormInput("text", "email", "email", "E-Mail", '', array('size'=>20,'maxlength'=>300));
        $form->addElement($email);


        
        
        //$name = new tfFormText("Name", "name", 10, 20, '', "name");
        //$form->addElement($name);
        //$form->addElement(new tfFormText("Email", 'email', 20, 300,'','email'));
        //$form->addElement(new tfFormTextArea("Leave your message here:", "msg", "msg"));
        //$form->addElement(new tfFormHidden("target_email", "redflowflag@at-scale.com"));
        $form->addElement(new tfFormTextArea("msg", "msg", "留言", "Lease your message here"));

        $select = new tfFormSelect("sel", "sel", "选择菜单", '', '1');
        $select->addOptionArray(array(1=>"选择1",2=>"选择2"));
        $form->addElement($select);

        $fieldset = new tfFormFieldset("这是一个fieldset");
        $fieldset->addElement(new tfFormInput("text", "name", "id", "输入框1"));

        $form->addElement($fieldset);

        $checkbox = new tfFormCheckBox("chkbox", "chkbox", "复选框", array('a','b'), "<br />",2);
        
        $checkbox->addOptionArray(array('a'=>'选择1','b'=>"选择2",'c'=>'选拔3','d'=>'选择4','e'=>'选择5'));
        $form->addElement($checkbox);

        $radio = new tfFormRadio("rad1", "rad1", "radio caption", 'd', '<hr />', 3);
        $radio->addOptionArray(array("a"=>"选项1",'b'=>'选项２','c'=>"选项C", 'd'=>"选项D",'e'=>"选项e"));
        $form->addElement($radio);

        $buttontray = new tfFormElementTray("");
        //new tfFormbutton($name, $id, $caption, $value, $attr_array)
        $buttontray->addElement(new tfFormbutton("submit", 'submit_form', 'submit_form', '', '提交'));
        $buttontray->addElement(new tfFormbutton("reset", 'reset_form', 'reset_form', '' , '重新填写'));
        $form->addElement($buttontray);
        
        //$form_content = $form->render();
        //echo "<pre>";
        //echo $form;
        //echo "</pre>";
        $this->assign("frm_test",strval($form));
        //$this->assign("_hidesidebar",1);
        //$this->assign("_hidemenu",1);
        $this->render_layout('mailform.html');
        
    }
}
?>
